$(function(){
	$("#functionNav").attr("href",navAddr);
	//获取并填充保管部门
	var bgbmJson = ajaxResult("get",false,ProjectName+"/sysmanage.getIdAndNameInjb.do",{'tableName':'jb_bgbm'});
	loadSelect("#bgbmid",bgbmJson.rows,'id','name');
	
	//根据保管部门id获取并填充库房
	$('#bgbmid').change(function(){
		var bgbmid = $(this).val();
		if(bgbmid !=null && bgbmid !=''){
			var kfJson = ajaxResult("get",false,ProjectName+"/sysmanage.getkfIdNameBybgbmId.do",{'bgbmId':bgbmid});
			loadSelect("select[name=szkf]",kfJson.rows,'kfid','kfmc');
		}
	});
	//获取查询条件
	var searchParams =$("#form1").serializeObject();	
	//初始化寄存单据Table	
	createTableOrderBy('#dbTable',ProjectName+'/colmanage.getCtkCpListByStatus.do','id',tblColTitle,searchParams);
	
	//点击查询按钮
	 $("#search_btn").click(function(){
		 refreshTable('#dbTable','#form1');
	 });
})

var tblColTitle = [{
			checkbox:true
		},{
	        field: 'djbh',
	        title: '单据编号',
	        sortable:true
	    }, 
	    {
	        field: 'zdjh',
	        title: '总登记号',
	        sortable:true
	    }, {
	        field: 'cpmc',
	        title: '藏品名称',
	        sortable:true,
	        formatter: function(value, row, index) {	        	
	        	return '<a href="chuTuiKuDetail.html?id='+row.id+'">'+value+'</a>';
		      }
	    }, {
	        field: 'lyztmc',
	        title: '利用主体',
	        sortable:true
	    }, {
	        field: 'cksl',
	        title: '出库数量',
	        sortable:true
	    }, {
	        field: 'cksj',
	        title: '出库时间',
	        sortable:true
	    }, {
	        field: 'tksj',
	        title: '退库时间',
	        sortable:true
	    },{
	        field: 'bckbz',
	        title: '是否出库',
	        sortable:true,
	        formatter: function(value, row, index) {
	        	if(row.bckbz==1){
	        		return  "取消出库";
	        	}else{
	        		return "";
	        	}
		      }	      
	    }];